home *** CD-ROM | disk | FTP | other *** search
/ Swimsuit Review 95 / Swimsuit Review 95.iso / pc / setup / setup1.frm < prev    next >
Text File  |  1995-07-14  |  9KB  |  292 lines

  1. VERSION 2.00
  2. Begin Form Setup1 
  3.    BackColor       =   &H00400000&
  4.    Caption         =   "Test App Setup"
  5.    ClientHeight    =   2130
  6.    ClientLeft      =   1860
  7.    ClientTop       =   2610
  8.    ClientWidth     =   5640
  9.    ControlBox      =   0   'False
  10.    FillStyle       =   0  'Solid
  11.    FontBold        =   -1  'True
  12.    FontItalic      =   -1  'True
  13.    FontName        =   "MS Sans Serif"
  14.    FontSize        =   24
  15.    FontStrikethru  =   0   'False
  16.    FontUnderline   =   0   'False
  17.    ForeColor       =   &H00000000&
  18.    Height          =   2535
  19.    Icon            =   SETUP1.FRX:0000
  20.    Left            =   1800
  21.    LinkMode        =   1  'Source
  22.    LinkTopic       =   "Form3"
  23.    MaxButton       =   0   'False
  24.    MinButton       =   0   'False
  25.    ScaleHeight     =   142
  26.    ScaleMode       =   3  'Pixel
  27.    ScaleWidth      =   376
  28.    Top             =   2265
  29.    Width           =   5760
  30.    Begin Label Label2 
  31.       BorderStyle     =   1  'Fixed Single
  32.       Caption         =   "To customize this setup program, modify the FORM_LOAD event procedure in this form."
  33.       Height          =   435
  34.       Left            =   15
  35.       TabIndex        =   1
  36.       Top             =   15
  37.       Visible         =   0   'False
  38.       Width           =   5625
  39.    End
  40.    Begin Label Label1 
  41.       BorderStyle     =   1  'Fixed Single
  42.       Caption         =   "This label used for DDE connection to the Program Manager"
  43.       Height          =   390
  44.       Left            =   15
  45.       TabIndex        =   0
  46.       Top             =   525
  47.       Visible         =   0   'False
  48.       Width           =   5610
  49.    End
  50. End
  51.  
  52. Const APPNAME = "Swimsuit Review"
  53. Const fDataAccess% = False
  54. Const fODBC% = False
  55. Const fBtrieve% = False
  56. Const fOLE2% = False
  57.  
  58. ' Set the total uncompressed file sizes
  59. ' by adding the sizes of the files
  60. Const WINSYSNEEDED = 1091104  ' Files that go into WINDOWS and SYSTEM directory
  61.  
  62. Sub DrawBackground ()
  63.     Setup1.CurrentY = 5
  64.     Setup1.CurrentX = 5
  65.     Setup1.ForeColor = QBColor(15)
  66.     Print APPNAME + " Setup"
  67. End Sub
  68.  
  69. Sub Form_Load ()
  70.     
  71.     '----------
  72.     ' Initialize
  73.     '----------
  74.     dialogCaption$ = APPNAME + " Setup"
  75.     ShowMainForm dialogCaption$
  76.     
  77.     theDrive$ = Left$(CurDir$, 2) + "\"
  78.     winDir$ = UCase$(GetWindowsDir$())
  79.     winSysDir$ = UCase$(GetWindowsSysDir$())
  80.     winDrive$ = UCase$(Left$(winDir$, 1))
  81.     
  82.     '-----------------------------------------
  83.     ' Dim disk space variables as Long Integers
  84.     '-----------------------------------------
  85.     Dim winSpaceFree As Long
  86.     Dim sourceSpaceFree As Long
  87.     Dim destSpaceFree As Long
  88.     Dim totalNeeded As Long
  89.  
  90.     '---------------------------------------------------------
  91.     ' If the Windows \SYSTEM directory is a subdirectory
  92.     ' of the Windows directory, the proper place for
  93.     ' installation of .VBXs and shared .DLLs is the
  94.     ' Windows \SYSTEM directory.
  95.     '
  96.     ' If the Windows \SYSTEM directory is *not* a subdirectory
  97.     ' of the Windows directory, then the user is running a
  98.     ' shared version of Windows, and the proper place for
  99.     ' installation of .VBXs and shared .DLLs is the
  100.     ' Windows directory.
  101.     '---------------------------------------------------------
  102.     If InStr(winSysDir$, winDir$) = 0 Then
  103.         winSysDir$ = winDir$
  104.     End If
  105.  
  106.     
  107.     '---------------------------------
  108.     ' Get Drive Letters of directories
  109.     '---------------------------------
  110.     destDrive$ = UCase$(Left$(destPath$, 1))
  111.     sourceDrive$ = theDrive$
  112.  
  113.     '---------------------------------
  114.     ' Compute free disk space variables
  115.     '---------------------------------
  116.     winSpaceFree = GetDiskSpaceFree(winDrive$)
  117.     destSpaceFree = GetDiskSpaceFree(destDrive$)
  118.     
  119.     '-----------------------------------------
  120.     ' Check for enough disk space.
  121.     '
  122.     ' Some components are being installed into the
  123.     ' Windows\SYSTEM directory.
  124.     '
  125.     ' So if the main destination path is on a
  126.     ' different drive than the drive with
  127.     ' the Windows \SYSTEM directory, we have to
  128.     ' check both drives.
  129.     '
  130.     ' An example of this is when the user is installing
  131.     ' the main product to drive D:, but the Windows
  132.     ' directory is on drive c:
  133.     ' -----------------------------------------
  134.     totalNeeded = WINSYSNEEDED + OTHERNEEDED
  135.     
  136.     If winDrive$ = destDrive$ Then
  137.         If destSpaceFree < totalNeeded Then
  138.             MsgBox "There is not enough disk space on drive " + destDrive$ + ":   An estimated" + Str$(totalNeeded - destSpaceFree) + " additional bytes are needed.", 16, dialogCaption$
  139.             GoTo ErrorSetup
  140.         End If
  141.     Else
  142.         If winSpaceFree < WINSYSNEEDED Then
  143.             MsgBox "There is not enough disk space on drive " + winDrive$ + ":  An estimated" + Str$(WINSYSNEEDED - winSpaceFree) + " additional bytes are needed.", 16, dialogCaption$
  144.             GoTo ErrorSetup
  145.         End If
  146.     End If
  147.  
  148.  
  149.  
  150.  
  151.     '-----------------------------------------------------------
  152.     ' Show Status Dialog -- This stays up while copying files
  153.     ' It is required by the CopyFile routine
  154.     '-----------------------------------------------------------
  155.     ShowStatusDialog dialogCaption$, totalNeeded
  156.     
  157.     
  158.     '-----------
  159.     ' Copy Files
  160.     '-----------
  161.  
  162.     If Not CopyFile(theDrive$, winSysDir$, "LIB\VBRUN300.DLL", "VBRUN300.DLL") Then GoTo ErrorSetup
  163.  
  164.  
  165.  
  166.     '--------------------------------------------------
  167.     ' File Copying is over, so unload the status dialog
  168.     '--------------------------------------------------
  169.     Unload StatusDlg
  170.  
  171.  
  172.     '-----------------------------------------------------------
  173.     ' Show static message while working on DDE to Program Manager
  174.     '-----------------------------------------------------------
  175.     ShowStaticMessageDialog dialogCaption$, "Creating Program Manager Icons..."
  176.  
  177.  
  178.     '--------------------------------------
  179.     ' Create program manager group and icon
  180.     '--------------------------------------
  181.     CreateProgManGroup Setup1, APPNAME, "SWMSUITX.GRP"
  182.     CreateProgManItem Setup1, theDrive$ + "PLAYER8.EXE", APPNAME
  183.     CreateProgManItem Setup1, theDrive$ + "README.TXT", APPNAME + " Info"
  184.     CreateProgManItem Setup1, theDrive$ + "REGISTER.WRI", "Registration"
  185.  
  186.  
  187.  
  188.     '-------------------------------------------------
  189.     ' Since SETUP.EXE copies your setup program to the Windows
  190.     ' directory, it is possible for your user to
  191.     ' execute this program directly.
  192.     '
  193.     ' As a usability feature, you may wish to insert code
  194.     ' here to install a program manager icon that executes
  195.     ' your setup program in the windows drive.  This
  196.     ' allows th user to re-run setup at a later time to
  197.     ' install options that were not installed the first
  198.     ' time.
  199.     '-------------------------------------------------
  200.  
  201.     '-------------------
  202.     ' Hide Static Message
  203.     '-------------------
  204.     MessageDlg.Hide
  205.     
  206.  
  207.  
  208.     '------------------
  209.     ' Show Final message
  210.     '------------------
  211.     Beep
  212.     MsgBox APPNAME + " Installation is complete!"
  213.    
  214. ExitSetup:
  215.     Setup1.Hide
  216.     RestoreProgMan         'Show the program manager
  217.     End
  218.     Exit Sub
  219.  
  220. ErrorSetup:
  221.     MsgBox APPNAME + " is not properly installed.  Please re-run setup at a later time to install " + APPNAME + " properly.", 48, dialogCaption$
  222.     ChDrive winDrive$   ' Set back to hard disk
  223.     ChDir Left$(winDir$, Len(winDir$) - 1)
  224.     End
  225.     Exit Sub
  226.     
  227. End Sub
  228.  
  229. Sub Form_Paint ()
  230.     'DrawBackground
  231. End Sub
  232.  
  233. '---------------------------------------------------------------
  234. ' Sets the form's caption, Paints 3-D Background Text, Shows Form
  235. '---------------------------------------------------------------
  236. Sub ShowMainForm (Caption$)
  237.     Screen.MousePointer = 11
  238.     Setup1.Caption = Caption$
  239.     Setup1.Move 0, 0, Screen.Width, Screen.Height * .85
  240.     Setup1.Show
  241.     Setup1.Refresh
  242.  
  243.     Setup1.ScaleMode = 2
  244.     Setup1.FontSize = 24
  245.     Setup1.FontBold = True
  246.     Setup1.FontItalic = False
  247.     
  248.     DrawBackground
  249. End Sub
  250.  
  251. Sub ShowPathDialog (title$, caption1$, caption2$, defaultDrive$, defaultText$, SourcePath$, outButton$)
  252.         Screen.MousePointer = 11
  253.         Load PathDlg
  254.         PathDlg.Caption = title$
  255.         PathDlg.Label1.Caption = caption1$
  256.         PathDlg.Label2.Caption = caption2$
  257.         PathDlg.inDrive.Tag = defaultDrive$
  258.         PathDlg.Text1.Text = defaultText$
  259.         PathDlg.Text1.SelStart = 0
  260.         PathDlg.Text1.SelLength = Len(defaultText$)
  261.         CenterForm PathDlg
  262.         Screen.MousePointer = 0
  263.  
  264.         PathDlg.Show 1
  265.         
  266.         SourcePath$ = PathDlg.outPath.Tag
  267.         outButton$ = PathDlg.outButton.Tag
  268.         Unload PathDlg
  269. End Sub
  270.  
  271. Sub ShowStaticMessageDialog (title$, Caption$)
  272.  
  273.     Load MessageDlg
  274.     CenterForm MessageDlg
  275.     MessageDlg.Caption = title$
  276.     MessageDlg.Label.Caption = Caption$
  277.     MessageDlg.Show
  278.     MessageDlg.Refresh
  279.  
  280. End Sub
  281.  
  282. Sub ShowStatusDialog (title$, totalBytes As Long)
  283.  
  284.     Load StatusDlg
  285.     StatusDlg.Caption = title$
  286.     StatusDlg.total.Tag = Str$(totalBytes)
  287.     CenterForm StatusDlg
  288.     StatusDlg.Show
  289.  
  290. End Sub
  291.  
  292.